package com.codejam.el.console.jsel;

import org.xidea.el.Expression;
import org.xidea.el.impl.ExpressionImpl;

import java.util.HashMap;

public class JselTest {

    public static void Test1(){

        Expression el = new ExpressionImpl("var1 + 2 * var2");
        HashMap context = new HashMap();

        context.put("var1",111);
        context.put("var2",2);

        Object evaluate = el.evaluate(context);

        System.out.println("evaluate = " + evaluate.toString());

        System.out.println("var1 = " + context.get("var1"));
        System.out.println("var2 = " + context.get("var2"));


        context.put("var2",3);

        System.out.println("var1 = " + context.get("var1"));
        System.out.println("var2 = " + context.get("var2"));

        System.out.println("evaluate2 = " + el.evaluate(context).toString());
    }
}
